<template>
  <div class="con">
    <div class="banxin">
      <div class="banner">
        <img src="../../assets//images//home/ad.png" alt="" />
      </div>
      <ul class="lists">
        <li v-for="(item, index) in cons" :key="index">
          <div class="list">
            <img
              :src="'http://sc.wolfcode.cn' + item.coverImg"
              alt=""
              class="img"
            />
            <p class="name">{{ item.name }}</p>
            <p class="price">{{ item.coin }}积分</p>
            <button>立即兑换</button>
            <img
              src="../../assets/images//home//new-j.png"
              alt=""
              class="img1"
              v-show="item.isLatest == 1"
            />
            <img
              src="../../assets/images//home//hot-j.png"
              alt=""
              class="img1"
              v-show="item.isHotSale == 1"
            />
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { HotApi } from "@/request/api";
export default {
  data() {
    return {
      cons: "",
      isHotSale: "",
      isLatest: "",
    };
  },
  props: ["arr"],
  created() {
    HotApi().then((res) => {
      console.log(res);
      this.cons = res.data.data.data.records;
      console.log(this.cons);
      this.isHotSale = res.data.data.data.records.isHotSale;
      this.isHotSale = res.data.data.data.records.isHotSale;
    });
  },
};
</script>
 
<style lang = "less" scoped>
@import "../../assets/base";

.lists {
  display: flex;
  flex-wrap: wrap;

  width: 1200px;
  li{
    margin-right: 20px;
    &:nth-of-type(4n){
      margin-right: 0;
    }
  }
  
  .list {
    width: 285px;
    height: 412px;
    text-align: center;
    font-size: 18px;
    background: #fff;
    margin-top: 20px;
    /* margin-right: 20px; */
    position: relative;

    .img {
      width: 100%;
      height: 250px;
      background: green;
      margin-bottom: 20px;
    }
    .img1 {
      position: absolute;
      left: 0;
      top: 0;
    }
    .name {
      margin-bottom: 20px;
    }
    .price {
      margin-bottom: 20px;
      color: red;
    }
    button {
      padding: 10px;
    }
    button:hover {
      background: blue;
      color: #fff;
    }
  }
}
</style>